import axiosInstance from "../../plugins/axios";
import { ElMessage } from "element-plus";

export const getTaskByIdType = async (formData: any) => {
  const res = await axiosInstance.post(
    `/tasks/idTypeSort`,formData
  );
  if (res.data.code == 1) {
    return res.data.data; // 返回数据
  } else {
    // ElMessage.error(res.data.message || "获取租户信息失败");
    throw new Error(res.data.message || "获取租户信息失败");
  }
};


export const searchTaskInfo = async (
  pageNum: number,
  pageSize: number,
  search: any
) => {
  const res = await axiosInstance.post("/tasks/search", {
    pageNum,
    pageSize,
    search,
  });
  if (res.data.code === 1) {
    return res.data.data; // 返回数据
  } else {
    // ElMessage.error(res.data.message || "搜索任务信息失败");
    throw new Error(res.data.message || "搜索用户信息失败");
  }
};
